#coding=utf-8
"""
common func
Author: kaspar
Date: 2022-04-09
"""
import base64

def encode_key(key):
    if not isinstance(key, bytes):
        key = bytes(key, encoding='utf-8')
    return base64.b64encode(key)

def decode_key(key):
    return base64.b64decode(key)